import { getStore, setStore } from '@/util/store'

const params = {
  state: {
    listPagePars: getStore({ name: 'listPagePars' }) || {}
  },
  actions: {
    //保存
    saveListPagePars: ({ commit }, { path, pars }) => {
      commit('SAVE_LIST_PAGE_PARS', { path, pars });
    },
  },
  getters: {
    listPagePars: state => {
      return state.listPagePars
    }
  },
  mutations: {
    SAVE_LIST_PAGE_PARS: (state, { path, pars }) => {
      state.listPagePars = {
        [path]: pars
      };
      setStore({
        name: 'listPagePars',
        content: state.listPagePars,
        type: 'session'
      })
    }
  }
};
export default params
